/**
 *
 * @param url   请求接口
 * @param data 请求数据
 * @param fun   回调函数
 * @author lcg
 * @date 2019/10/17
 */

function POST(url,data,fun){
    $.ajax({
        url: url,
        type: 'POST',
        data: data,
        success:function (data) {
            if (data.status === 2001)
                window.location.href = '/page/login';
            else
                if (fun){
                    fun(data);
                }
            /*var map = _mapGetValue("device.remark",JSON.stringify(data.data[0]));

           debugger
            console.log(map)*/
        }
    });
}

function GET(url,data,fun) {
    $.ajax({
        url: url,
        type: 'GET',
        data: data,
        success:function (data) {
            if (data.status === 2001)
                window.location.href = '/page/login';
            else
                fun(data);
        }
    });
}

function AJAX_POST(url,data,fun) {
    $.ajax({
        url: url,
        type: 'POST',
        data: data,
        contentType: 'application/json;charset=UTF-8',
        type: 'json',
        success:function (data) {
            if (data.status === 2001)
                window.location.href = '/page/login';
            else
                fun(data);
        }
    });
}

function AJAX_GET(url,data,fun) {
    $.ajax({
        url: url,
        type: 'GET',
        data: data,
        contentType: 'application/json;charset=UTF-8',
        type: 'json',
        success:function (data) {
            if (data.status === 2001)
                window.location.href = '/page/login';
            else
                fun(data);
        }
    });
}

function Alert(data) {
    alert(data.massage);
}